CREATE TABLE [dbo].[RECIBOS_PAGOS_DETALLES]
(
[ID] [numeric] (10, 0) NOT NULL,
[ID_FACTURA] [numeric] (10, 0) NOT NULL,
[DESCUENTO] [numeric] (10, 2) NOT NULL CONSTRAINT [DF_RECIBOS_PAGOS_DETALLES_DESCUENTO] DEFAULT ((0)),
[X_DESCUENTO] [numeric] (10, 4) NOT NULL CONSTRAINT [DF_RECIBOS_PAGOS_DETALLES_X_DESCUENTO] DEFAULT ((0)),
[MONTO] [numeric] (10, 2) NOT NULL CONSTRAINT [DF_RECIBOS_PAGOS_DETALLES_MONTO] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RECIBOS_PAGOS_DETALLES] ADD CONSTRAINT [PK_RECIBOS_PAGOS_DETALLES] PRIMARY KEY CLUSTERED  ([ID], [ID_FACTURA]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RECIBOS_PAGOS_DETALLES] ADD CONSTRAINT [FK_RECIBOS_PAGOS_DETALLES_RECIBOS_PAGOS] FOREIGN KEY ([ID]) REFERENCES [dbo].[RECIBOS_PAGOS] ([ID])
GO
ALTER TABLE [dbo].[RECIBOS_PAGOS_DETALLES] ADD CONSTRAINT [FK_RECIBOS_PAGOS_DETALLES_FACTURAS] FOREIGN KEY ([ID_FACTURA]) REFERENCES [dbo].[FACTURAS] ([ID])
GO
